import {createStore,applyMiddleware,compose} from 'redux';
import reducer from './../reducers/couter'
import thunk from 'redux-thunk';
import { createLogger } from 'redux-logger';
import promise from 'redux-promise';
import DevTools from './DevTools'

const loggerMiddleware = createLogger()
// 创建一个中间件集合
const middleware = [thunk, promise,loggerMiddleware]

// const store = createStore(reducer,applyMiddleware(thunk));

// 利用compose增强store，这个 store 与 applyMiddleware 和 redux-devtools 一起使用
// const finalCreateStore = compose(
//     applyMiddleware(...middleware),
//     DevTools.instrument(),
// )(createStore)
const finalCreateStore = compose(
    applyMiddleware(...middleware)
)(createStore)

export default finalCreateStore;